﻿using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ymatou.ServiceCenter;

namespace YmtAuth.Dto
{
    /// <summary>
    /// 用户token
    /// </summary>
    [Resource("auth.ymatou.com", "/json/reply/UserTokenDto", Method.POST, ParameterBuildType.FormUrlEncoded)]
    public class UserTokenDto
    {
        /// <summary>
        /// userId
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        /// 超时时间
        /// </summary>
        public long? TokenTimeOut { get; set; }
        /// <summary>
        /// 应用来源，使用 Ymatou.User.Common.UserEnum.UserRegSource.ToString() 注册应用来源值
        /// </summary>
        public string TokenSource { get; set; }
        /// <summary>
        /// 应用场景（login，reg）
        /// </summary>
        public string Context { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("UserTokenDto Parameters: ");
            sb.AppendFormat("Context: {0}, ", Context);
            sb.AppendFormat("UserId: {0}, ", UserId);
            sb.AppendFormat("TokenSource: {0}, ", TokenSource);
            sb.AppendFormat("TokenTimeOut: {0}", TokenTimeOut);

            string str = sb.ToString();
            return str.Length > 1000 ? str.Substring(0, 1000) : str;
        }
    }
}
